import {
  request
} from '../utils/request';

// 名片列表
let getCardList = (data = {}) => {
  return request({
    url: '/card/list',
    method: 'POST',
    data: {
      ...data
    }
  });
}

// 添加自己的名片
let addSelfCard = (data = {}) => {
  return request({
    url: '/card/self',
    method: 'POST',
    data: {
      ...data,
      isDefault: 1
    }
  });
}

// 编辑自己名片
let editSelfCard = (data = {}) => {
  return request({
    url: '/card/editSelf',
    method: 'POST',
    data: {
      ...data
    }
  });
}

// 添加他人名片
let addOtherCard = (data = {}) => {
  return request({
    url: '/card/other',
    method: 'POST',
    data: {
      ...data
    }
  });
}

// 编辑他人名片
let editOtherCard = (data = {}) => {
  return request({
    url: '/card/editOther',
    method: 'POST',
    data: {
      ...data
    }
  });
}

// 关联名片
let connectCard = (cardId, relateId) => {
  return request({
    url: `/card/renew/${cardId}/${relateId}`
  });
}

// 取消首页名片更新提醒
let remindConnectCard = (cardId) => {
  return request({
    url: `/card/read/${cardId}`
  });
}

// 删除名片
let removeCard = (cardId) => {
  return request({
    url: `/card/remove/${cardId}`
  });
}

// 名片详情
let getCardDetails = (cardId) => {
  return request({
    url: `/card/${cardId}`
  });
}

// 名片关联列表
let connectCardList = (cardId) => {
  return request({
    url: `/card/relateList/${cardId}`,
    method: 'POST'
  });
}

// 添加名片到收到的列表
let addReceivedCard = (cardId) => {
  return request({
    url: `/card/recipeCard/${cardId}`,
    method: 'POST'
  });
}

// 收到的名片添加到通讯录
let receivedCardToMailList = (cardId) => {
  return request({
    url: `/card/addressBook/${cardId}`,
    method: 'POST'
  });
}

// 直接添加到通讯录
let toMailList = (cardId) => {
  return request({
    url: `/card/add/addressBook/${cardId}`,
    method: 'POST'
  });
}

// 通讯录名片转到收到的列表
let ToReceivedCard = (cardId) => {
  return request({
    url: `/card/toRecipe/${cardId}`
  });
}

// 设置默认
let setDefault = (cardId) => {
  return request({
    url: `/card/self/default/${cardId}`,
    method: 'POST'
  });
}

// 音乐列表
let musicList = () => {
  return request({
    url: '/music/list'
  });
}

// 行业列表
let tradeList = () => {
  return request({
    url: '/industry/list'
  });
}

// 识别名片信息
let distinguishCard = (image) => {
  return request({
    url: '/card/distinguish',
    data: {
      image: image
    }
  });
}

// 客服微信
let customerService = () => {
  return request({
    url: '/cusService/list'
  });
}

// 客服微信
let articleDetails = (id) => {
  return request({
    url: `/article/get/${id}`
  });
}

// oss签名
let getOSSAutograph = (id) => {
  return request({
    url: '/oss/sign'
  });
}

module.exports = {
  getCardList,
  addSelfCard,
  editSelfCard,
  addOtherCard,
  editOtherCard,
  connectCard,
  remindConnectCard,
  removeCard,
  getCardDetails,
  connectCardList,
  addReceivedCard,
  receivedCardToMailList,
  toMailList,
  ToReceivedCard,
  setDefault,
  musicList,
  tradeList,
  distinguishCard,
  customerService,
  articleDetails,
  getOSSAutograph
}